tighten sandbox handles and template creds#10
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughPrivatizes sandbox-scoped services on sync/async clients (moved to underscored attributes), adds a SandboxHandle type, rewires sandbox-bound proxies to use private client attrs, introduces typed registry credential models and union, updates TemplatesClient.create signatures, and adjusts tests and doc examples. Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(66,133,244,0.5)
participant Caller
end
rect rgba(15,157,88,0.5)
participant Client
end
rect rgba(244,180,0,0.5)
participant Sandbox
end
rect rgba(219,68,55,0.5)
participant Service
end
Caller->>Client: access attribute "filesystem"
alt attribute scoped to sandbox only
Client->>Caller: AttributeError("use sandbox.filesystem")
else Caller uses sandbox
Caller->>Sandbox: sandbox.filesystem.method(...)
Sandbox->>Client: access client._filesystem
Client->>Service: perform operation
Service-->>Client: result
Client-->>Sandbox: return result
Sandbox-->>Caller: return result
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
leap0/__init__.py (1)
337-337:⚠️ Potential issue | 🔴 CriticalOrphaned code fragment at end of file.
Line 337 contains
"GcpRegistryCredentialsDict",which appears to be a stray line outside any valid Python structure. This will cause aSyntaxErrorat module load time.🐛 Proposed fix: remove the orphaned line
def __dir__() -> list[str]: return sorted(__all__) - "GcpRegistryCredentialsDict",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@leap0/__init__.py` at line 337, Remove the stray orphaned line containing the bare string "GcpRegistryCredentialsDict" at the end of the module so the file is syntactically valid; search for the symbol GcpRegistryCredentialsDict to ensure it isn't accidentally duplicated and, if it should exist, reintroduce it properly as part of a class, type alias, or __all__ list rather than as a standalone string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/models/test_config.py`:
- Around line 55-56: The pytest assertion uses match="sandbox.filesystem" which
treats the dot as a regex wildcard; update the pytest.raises call (the one
asserting access to client.filesystem) to use an escaped regex so it matches the
literal text, e.g. change the match to a raw/escaped pattern like
r"sandbox\.filesystem" to ensure precise matching of the error message.
---
Outside diff comments:
In `@leap0/__init__.py`:
- Line 337: Remove the stray orphaned line containing the bare string
"GcpRegistryCredentialsDict" at the end of the module so the file is
syntactically valid; search for the symbol GcpRegistryCredentialsDict to ensure
it isn't accidentally duplicated and, if it should exist, reintroduce it
properly as part of a class, type alias, or __all__ list rather than as a
standalone string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0568d0d8-b366-412a-a8f8-4e56a41b9834
📒 Files selected for processing (22)
leap0/__init__.pyleap0/_async/client.pyleap0/_async/filesystem.pyleap0/_async/process.pyleap0/_async/sandbox.pyleap0/_async/templates.pyleap0/_internal/types.pyleap0/_sync/client.pyleap0/_sync/code_interpreter.pyleap0/_sync/filesystem.pyleap0/_sync/process.pyleap0/_sync/sandbox.pyleap0/_sync/templates.pyleap0/models/sandbox.pyleap0/models/template.pytests/_async/test_client.pytests/_async/test_sandboxes.pytests/_sync/test_sandboxes.pytests/models/test_config.pytests/models/test_sandbox.pytests/models/test_template.pytests/test_import.py
Summary by CodeRabbit
Breaking Changes
New Features
Documentation
Bug Fixes